package org.serverct.finalfight.stat;


import org.serverct.finalfight.game.hadesgame.EventType;

import java.util.HashMap;

public class IPlayer {
    public int played;
    public int won;
    public int kill;
    public int death;
    public HashMap<EventType, Integer> experience;

    public IPlayer(int played, int won, int kill, int death, HashMap<EventType, Integer> experience) {
        this.played = played;
        this.won = won;
        this.kill = kill;
        this.death = death;
        this.experience = experience;
    }

    public void addExperience(EventType type) {
        if (!this.experience.containsKey(type)) {
            this.experience.put(type, 1);
        } else {
            this.experience.put(type, this.experience.get(type) + 1);
        }
    }

    public void win() {
        this.played++;
        this.won++;
    }

    public void lose() {
        this.played++;
    }

    public void kill() {
        this.kill++;
    }

    public void death() {
        this.death++;
    }

    public double getKDQuation() {
        return (double) this.kill / this.death;
    }

    public double getWinRate() {
        return (double) this.won / this.played;
    }
}
